package com.hh.bss.base;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class DaoFactory<T> {
	
     public static<T> T   getDao(ServletContext sc,Class T,String bn){
    	 WebApplicationContext ctx=WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
    	 T t= (T)ctx.getBean(bn);
    	//System.out.println( t.getClass().getName());
    	//System.out.println(t.getClass().getSimpleName());
    	 return t;
     }
   public static void main(String[] arg){
	   DaoFactory a=new DaoFactory();
	   //a.getDao(com.tb.bss.customer.dao.CompanyCvDao.class,"companyCvDaoImpl");
   }
}
